package com.augurit.gzcgwsp.printDoc.web;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.orm.Page;
import org.springside.modules.web.struts2.Struts2Utils;

import com.augurit.common.base.action.CrudActionSupport;
import com.augurit.common.base.action.ExtBaseAction;
import com.augurit.common.base.extmodel.BasicCombo;
import com.augurit.common.base.form.Attachment;
import com.augurit.common.util.ExtUtils;
import com.augurit.common.util.lang.DateUtils;
import com.augurit.gzcgwsp.commonex.util.lang.DateUtilsEX;
import com.augurit.gzcgwsp.printDoc.service.IYwPrintDocService;
import com.augurit.gzcgwsp.printDoc.web.form.YwPrintDocForm;
import com.augurit.gzcgwsp.state.util.RequestUtil;
import com.augurit.gzcgwsp.wfex.app.doc.IOaDocCodeServiceEX;
import com.augurit.gzcgwsp.wfex.bi.service.IWfBusTemplateServiceEX;
import com.augurit.gzcgwsp.wfex.bi.service.IWfTemplateAttachmentRefServiceEX;
import com.augurit.gzcgwsp.wfex.bi.web.form.WfTemplateAttachmentRefFormEX;
import com.augurit.wf.common.constant.WfConstant;
import com.augurit.wf.common.entity.WfBusTemplate;
import com.augurit.wf.common.util.WfUtils;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;

/**
 * 公告板管理Action类
 */
@SuppressWarnings("serial")
@Results({
	@Result(name = CrudActionSupport.RELOAD, location = "oa-notice.action", type = "redirect"),
	@Result(name = CrudActionSupport.SUCCESS, location = "/wf/app/notice/notice-input.jsp"),
	@Result(name ="findfileNum", location = "/gzcgwsp/state/listFileNum.jsp"),
	@Result(name ="findqufileNum", location = "/gzcgwsp/state/listQuFileNum.jsp"),
	@Result(name ="toCkrqqydjb", location = "/gzcgwsp/state/listRqQyDjb.jsp"),
	@Result(name = WfConstant.PRINT, location = WfConstant.PRINT_JSP)
})
public class YwPrintDocAction extends ExtBaseAction implements ModelDriven<YwPrintDocForm>, Preparable{	
	
	@Autowired
	private IYwPrintDocService ywPrintDocService;	//公告板service类
	@Autowired
	private IWfBusTemplateServiceEX WfBusTemplateServiceEX;
	@Autowired
	private IWfTemplateAttachmentRefServiceEX wfTemplateAttachmentRefServiceEX;
    @Autowired
    private IOaDocCodeServiceEX oaDocCodeServiceEX;
	private YwPrintDocForm form;	//公告板form对象
	private Page page ;
	private Long id;			//公告板id

	public String getTemplateCode() {
		return getParameter(WfConstant.PARAM_TEMPLATECODE);
	}

	public boolean isNewForm() {
		return form.getId() == null ? true : false;
	}

	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}
	/**
	 * 打印公告单
	 */
	public String printNotice() throws Exception {
		return WfUtils.wfBusPrint(form);
	}
	
	public String input() throws Exception {		
		this.extRenderFormJson(form);
		return null;
	}
	
	
	/************************************************
	 * 			get和set方法      					*
	 ************************************************/
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	//检查告知
	public String checkData() throws IOException{
		String ywId=getRequest().getParameter("ywId");
		if(StringUtils.isBlank(ywId)){
			return null;
		}
		String templateCode=getRequest().getParameter("templateCode");
		String fileCode=getRequest().getParameter("fileCode");
	
		if(StringUtils.isBlank(form.getFileNum())){
			getResponse().getWriter().print("fileNumEmpty");
			return null;
		}else{
			int num=Integer.valueOf(form.getFileNum());
			//文号是否一致
			Long seq=oaDocCodeServiceEX.getCurSeqAndAddSeq(templateCode, fileCode, Long.valueOf(ywId));
			if(seq.intValue()!=num){
				getResponse().getWriter().print("numdiff");
				return null;
			}
			//文号是否存在
			boolean fileflag=ywPrintDocService.checkFileNum(ywId,templateCode,fileCode,form.getFileNum());
			if(fileflag==false){
				getResponse().getWriter().print("numExist");
				return null;
			}
			boolean flag=ywPrintDocService.checkDate(ywId,templateCode,fileCode);
			if(flag==false){
				getResponse().getWriter().print("fail");
			}else{
				getResponse().getWriter().print("success");
			}
			return null;
			}
	}
	
	
	/**
	 * 区的文号管理
	 * @return
	 */
	public String findQuFileNum(){
		String type=getParameter("type");
		Map map=this.getMapByRequest(getRequest());
		if(StringUtils.isNotBlank(type)){//表示制文的时候查看
			String year=DateUtilsEX.getCurYear();
			//生成文号类型
			List filetypes=this.ywPrintDocService.getFileType(map);
			if(filetypes.size()>0){
				getRequest().setAttribute("filetypes", filetypes.get(0));
			}
			String templateCode=(String) map.get("templateCode");
			String fileCode=(String) map.get("fileCode");
			getRequest().setAttribute("curyear", year);
			getRequest().setAttribute("fileCode", fileCode);
			getRequest().setAttribute("templateCode", templateCode);
		}
		return "findqufileNum";
	}
	
	//检查文号
	public String checkQuFileData() throws IOException{
		String ywId=getRequest().getParameter("ywId");
		if(StringUtils.isBlank(ywId)){
			return null;
		}
		String templateCode=getRequest().getParameter("templateCode");
		String fileCode=getRequest().getParameter("fileCode");
	
		if(StringUtils.isBlank(form.getFileNum())){
			getResponse().getWriter().print("fileNumEmpty");
			return null;
		}else{
			int num=Integer.valueOf(form.getFileNum());
			//文号是否一致
			Long seq=oaDocCodeServiceEX.getQuCurSeqAndAddSeq(templateCode, fileCode, Long.valueOf(ywId),getLoginUser());
			if(seq.intValue()!=num){
				getResponse().getWriter().print("numdiff");
				return null;
			}
			//文号是否存在
			boolean fileflag=ywPrintDocService.checkQuFileNum(ywId,templateCode,fileCode,form.getFileNum(),getLoginUser());
			if(fileflag==false){
				getResponse().getWriter().print("numExist");
				return null;
			}
			String flagstr=ywPrintDocService.checkQuData(ywId,templateCode,fileCode);
			if("notgzdata".equals(flagstr)){
				getResponse().getWriter().print("notgzdata");
			}else if("fail".equals(flagstr)){
				getResponse().getWriter().print("fail");
			}else{
				getResponse().getWriter().print("success");
			}
			return null;
			}
	}
	public String save() throws Exception {
	    String templateId=getRequest().getParameter("templateId");
	    String userName=getLoginUser().getUser().getUserName();
	    String isbjgz=getRequest().getParameter("bjgz");
	   // WfTemplateAttachmentRefForm refForm=ywPrintDocService.updateRefForm(form,templateId,userName);
	    
		List<Attachment> attachments = this.getAttachmentList();
    	if(attachments != null && attachments.size() > 0){
    		for(Attachment attachment:attachments){
    			String filePath = "/printdoc/"+form.getTemplateCode();
    			String fileName = "";
    			System.out.println(attachment.getFileFileName()+"-----------------------");
    			boolean hasRecord = false;
    			List<YwPrintDocForm> ywPrintDocFormList = ywPrintDocService.get(form.getTemplateCode(), form.getFileCode(), form.getYwId());
    			if(ywPrintDocFormList!=null && ywPrintDocFormList.size()>0){
    				YwPrintDocForm ypdf = ywPrintDocFormList.get(0);
    				String path = ypdf.getPath();
    				fileName = path.substring(path.lastIndexOf('/')+1);
    				hasRecord = true;
    				ywPrintDocService.updateRefForm(ypdf,templateId,userName);
    			}else{
    				fileName = String.valueOf(new Date().getTime())+".doc";
    			}
    			 
    			boolean success = uploadFile(filePath, fileName, attachment, false, true, true);
            	
        		if(success && !hasRecord){
        			String fullPath = filePath + "/" + fileName;
        			form.setPath(fullPath);
        			if(form.getCreatDate()==null){
        			    form.setCreatDate(new Date());
        			}
        			if(StringUtils.isBlank(form.getCreator())){
        			    form.setCreator(userName);
        			}
        			form=ywPrintDocService.setForm(form,templateId);
        			
        			if(StringUtils.isNotBlank(form.getFileCode()) && "xkz".equals(form.getFileCode())){
        				//保存时候生成编号 解决制文每次刷新生成新的编号问题
                        oaDocCodeServiceEX.saveSeq(form.getTemplateCode(),form.getFileCode(), form.getYwId(),"false");
        			}        			
        			if("false".equals(isbjgz)){
        				ywPrintDocService.save(form);
        			}else{
        				ywPrintDocService.saveEntity(form);
        			}
        			
        			
        			ExtBaseAction.extRenderSuccess();
        			return null;
        		}
        		//第二次保存文档的时候，提示成功
        		if(hasRecord){
        			ExtBaseAction.renderJson("{\"success\":true}");
        			return null;
        		}
    		}
    	}
		return null;
	}

	public String savequMakeDocument() throws Exception {
	    String templateId=getRequest().getParameter("templateId");
	    String isunified=getRequest().getParameter("isunified");
	    String isbjgz=getRequest().getParameter("bjgz");
	    String userName=getLoginUser().getUser().getUserName();
		List<Attachment> attachments = this.getAttachmentList();
    	if(attachments != null && attachments.size() > 0){
    		Attachment attachment = attachments.get(0);
    			String filePath = "/printdoc/"+form.getTemplateCode();
    			String fileName = "";
    			YwPrintDocForm ywPDForm = new YwPrintDocForm();
    			//此处不需要循环查模版
    			//List<WfTemplateAttachmentRefForm> lists = wfTemplateAttachmentRefServiceEX.listAllZhengWenFiles(form.getTemplateCode());
    			//for(WfTemplateAttachmentRefForm f : lists){
    				List<YwPrintDocForm> tList = ywPrintDocService.get(form.getTemplateCode(), form.getFileCode(), form.getYwId());
    				if(tList!=null && tList.size()>0){
    					ywPDForm = tList.get(0);
    					//break;
    				}
    			//}
    			if(ywPDForm.getId() == null){
    				fileName = String.valueOf(new Date().getTime())+".doc";
    			}else{
    				fileName = ywPDForm.getPath().substring(ywPDForm.getPath().lastIndexOf('/')+1);
    				form.setId(ywPDForm.getId());
    			}
    			
    			boolean success = uploadFile(filePath, fileName, attachment, false, true, true);
    			
        		if(success){
        			String fullPath = filePath + "/" + fileName;
        			form.setPath(fullPath);
                    if(ywPDForm!=null){
                        if(ywPDForm.getCreatDate()==null)
                            form.setCreatDate(new Date());
                        else
                            form.setCreatDate(ywPDForm.getCreatDate());
                        if(StringUtils.isBlank(ywPDForm.getCreator()))
                            form.setCreator(userName);
                        else
                            form.setCreator(ywPDForm.getCreator());
                        
                    }else{
                        form.setCreatDate(new Date());
                        form.setCreator(userName);
                    }
                    if(StringUtils.isNotBlank(templateId)){
                        form.setTempdocId(Long.valueOf(templateId));
                    }
                    //重新修改文号内容
                    if(StringUtils.isNotBlank(form.getFileNum()) && 
                    		StringUtils.isNotBlank(templateId)){
                    	String fileNum=form.getFileNum();
                    	//获取模版的实体
                    	WfBusTemplate temp=WfBusTemplateServiceEX.getEntityByCode(form.getTemplateCode());
                    	WfTemplateAttachmentRefFormEX ref=wfTemplateAttachmentRefServiceEX.
                    	getFormByCode(form.getFileCode(),temp.getId());
                    	//重新构造文号格式如“穗城管委窗补+2012+30号”
                    	if(ref!=null){
                    		//文号用0填上
                    		String idxNum="";
                    		if("csdllszysp".equals(form.getTemplateCode())
                    				|| "csdlwj".equals(form.getTemplateCode())){
                    			if(fileNum.length()<3){
                        			for(int k=0;k<3-fileNum.length();k++){
                            			idxNum+="0";
                            		}
                            		fileNum=idxNum+fileNum;
                        		}
                    		}else{
                    			if(fileNum.length()<2){
                        			for(int k=0;k<2-fileNum.length();k++){
                            			idxNum+="0";
                            		}
                            		fileNum=idxNum+fileNum;
                        		}
                    		}
                    		String orgname=this.getLoginUser().getOrg().getOrgName().substring(0,1);
                    		fileNum=ref.getMemo()+"("+orgname+")["+DateUtilsEX.getCurYear()+"]"+fileNum+"号";
                    		form.setFileNum(fileNum);
                    	}
                    }
                    //保存时候生成编号 解决制文每次刷新生成新的编号问题
                    oaDocCodeServiceEX.saveSeq(form.getTemplateCode(),form.getFileCode(), form.getYwId(),isunified);
                	if("false".equals(isbjgz)){
        				ywPrintDocService.save(form);
        			}else{
        				ywPrintDocService.savequEntity(form);
        			}
        			
        			ExtBaseAction.extRenderSuccess();
        			return null;
        		}
    	}
		return null;
	}
	
	
	
	public String saveMakeDocument() throws Exception {
	    String templateId=getRequest().getParameter("templateId");
	    String isunified=getRequest().getParameter("isunified");
	    String isbjgz=getRequest().getParameter("bjgz");
	    String userName=getLoginUser().getUser().getUserName();
		List<Attachment> attachments = this.getAttachmentList();
    	if(attachments != null && attachments.size() > 0){
    		Attachment attachment = attachments.get(0);
    			String filePath = "/printdoc/"+form.getTemplateCode();
    			String fileName = "";
    			YwPrintDocForm ywPDForm = new YwPrintDocForm();
    			//此处不需要循环查模版
    			//List<WfTemplateAttachmentRefForm> lists = wfTemplateAttachmentRefServiceEX.listAllZhengWenFiles(form.getTemplateCode());
    			//for(WfTemplateAttachmentRefForm f : lists){
    				List<YwPrintDocForm> tList = ywPrintDocService.get(form.getTemplateCode(), form.getFileCode(), form.getYwId());
    				if(tList!=null && tList.size()>0){
    					ywPDForm = tList.get(0);
    					//break;
    				}
    			//}
    			if(ywPDForm.getId() == null){
    				fileName = String.valueOf(new Date().getTime())+".doc";
    			}else{
    				fileName = ywPDForm.getPath().substring(ywPDForm.getPath().lastIndexOf('/')+1);
    				form.setId(ywPDForm.getId());
    			}
    			
    			boolean success = uploadFile(filePath, fileName, attachment, false, true, true);
    			
        		if(success){
        			String fullPath = filePath + "/" + fileName;
        			form.setPath(fullPath);
                    if(ywPDForm!=null){
                        if(ywPDForm.getCreatDate()==null)
                            form.setCreatDate(new Date());
                        else
                            form.setCreatDate(ywPDForm.getCreatDate());
                        if(StringUtils.isBlank(ywPDForm.getCreator()))
                            form.setCreator(userName);
                        else
                            form.setCreator(ywPDForm.getCreator());
                        
                    }else{
                        form.setCreatDate(new Date());
                        form.setCreator(userName);
                    }
                    if(StringUtils.isNotBlank(templateId)){
                        form.setTempdocId(Long.valueOf(templateId));
                    }
                    //重新修改文号内容
                    if(StringUtils.isNotBlank(form.getFileNum()) && 
                    		StringUtils.isNotBlank(templateId)){
                    	String fileNum=form.getFileNum();
                    	//获取模版的实体
                    	WfBusTemplate temp=WfBusTemplateServiceEX.getEntityByCode(form.getTemplateCode());
                    	WfTemplateAttachmentRefFormEX ref=wfTemplateAttachmentRefServiceEX.
                    	getFormByCode(form.getFileCode(),temp.getId());
                    	//重新构造文号格式如“穗城管委窗补+2012+30号”
                    	if(ref!=null){
                    		//文号用0填上
                    		String idxNum="";
                    		if("csdllszysp".equals(form.getTemplateCode())
                    				|| "csdlwj".equals(form.getTemplateCode())){
                    			if(fileNum.length()<3){
                        			for(int k=0;k<3-fileNum.length();k++){
                            			idxNum+="0";
                            		}
                            		fileNum=idxNum+fileNum;
                        		}
                    		}else{
                    			if(fileNum.length()<2){
                        			for(int k=0;k<2-fileNum.length();k++){
                            			idxNum+="0";
                            		}
                            		fileNum=idxNum+fileNum;
                        		}
                    		}
                    		
                    		fileNum=ref.getMemo()+"["+DateUtilsEX.getCurYear()+"]"+fileNum+"号";
                    		form.setFileNum(fileNum);
                    	}
                    }
                    //保存时候生成编号 解决制文每次刷新生成新的编号问题
                    oaDocCodeServiceEX.saveSeq(form.getTemplateCode(),form.getFileCode(), form.getYwId(),isunified);
                	if("false".equals(isbjgz)){
        				ywPrintDocService.save(form);
        			}else{
        				ywPrintDocService.saveEntity(form);
        			}
        			
        			ExtBaseAction.extRenderSuccess();
        			return null;
        		}
    	}
		return null;
	}
	
	/**
	 * 获取文号类别
	 * @return
	 */
	public String getFileType(){
		Map param=this.getRequest().getParameterMap();
		 List list=this.ywPrintDocService.getFileType(param);
    	 List<BasicCombo> combos = new ArrayList<BasicCombo>();
    	 if(list!=null && list.size()>0){
    		 for (int i=0;i<list.size();i++) {
    			 String filetype=(String) list.get(i);
  				BasicCombo combo = new BasicCombo();
  				combo.setLabel(filetype);
  				combo.setValue(filetype);
 				combos.add(combo);
 		 }
    	}
    	 ExtBaseAction.extRenderListJson(combos, true);
		
		return null;
	}
	
	
	
	/**
	 * 获取文号类别
	 * @return
	 */
	public String getQuFileType(){
		Map param=getRequest().getParameterMap();
		 List list=ywPrintDocService.getquFileType(param);
    	 List<BasicCombo> combos = new ArrayList<BasicCombo>();
    	 if(list!=null && list.size()>0){
    		 for (int i=0;i<list.size();i++) {
    			 String filetype=(String) list.get(i);
    			 filetype=filetype+"("+getLoginUser().getOrg().getOrgName().substring(0,1)+")";
  				BasicCombo combo = new BasicCombo();
  				combo.setLabel(filetype);
  				combo.setValue(filetype);
 				combos.add(combo);
 		 }
    	}
    	 ExtBaseAction.extRenderListJson(combos, true);
		
		return null;
	}
	
	
	
	
	/**
	 * 获取区的文号
	 * @return
	 */
	public String getQuFileNums(){
		Map map = RequestUtil.getMapByRequest(getRequest());
		String fileYear=getRequest().getParameter("fileyear");
		String fileCode=getRequest().getParameter("fileCode");
		String templateCode=getRequest().getParameter("templateCode");
		if(StringUtils.isNotBlank(fileCode) && StringUtils.isNotBlank(templateCode)){
			//从制文那边跳转过来的页面
			String filetype=(String)map.get("filetype");
			String fileyear=(String)map.get("fileyear");
			if(StringUtils.isBlank(filetype)){
				List filetypes=this.ywPrintDocService.getFileType(map);
				if(filetypes.size()>0){
					map.put("filetype", filetypes.get(0));
				}
			}
			if(StringUtils.isBlank(fileyear)){
				map.put("fileyear", DateUtilsEX.getCurYear());
			}
		}
	    if(page==null){
	  		  page = new Page(15);
	  	 }
	    ExtUtils.initPageFromExtGridParam(getRequest(), page);
	    map.put("orgName", getLoginUser().getOrg().getOrgName());
	  	page=this.ywPrintDocService.searchQuFileNum(page,map);
	  	renderText(Struts2Utils.getJsonString(page, DateUtils.YYYY_MM_DD_HH_MM_SS));
	  	
	  	return null;
	}
	/**
	 * 获取所有文号
	 * @return
	 */
	public String getFileNums(){
		Map map = RequestUtil.getMapByRequest(getRequest());
		String fileYear=getRequest().getParameter("fileyear");
		String fileCode=getRequest().getParameter("fileCode");
		String templateCode=getRequest().getParameter("templateCode");
		if(StringUtils.isNotBlank(fileCode) && StringUtils.isNotBlank(templateCode)){
			//从制文那边跳转过来的页面
			String filetype=(String)map.get("filetype");
			String fileyear=(String)map.get("fileyear");
			if(StringUtils.isBlank(filetype)){
				List filetypes=this.ywPrintDocService.getFileType(map);
				if(filetypes.size()>0){
					map.put("filetype", filetypes.get(0));
				}
			}
			if(StringUtils.isBlank(fileyear)){
				map.put("fileyear", DateUtilsEX.getCurYear());
			}
		}
	    if(page==null){
	  		  page = new Page(15);
	  	 }
	    ExtUtils.initPageFromExtGridParam(getRequest(), page);
	  	page=this.ywPrintDocService.search(page,map);
	  	renderText(Struts2Utils.getJsonString(page, DateUtils.YYYY_MM_DD_HH_MM_SS));
	  	
	  	return null;
	}
    /**
     * 导出审批查询数据
     * @return
     * @throws IOException 
     */
    public String exportData() throws IOException{
    	Map map=RequestUtil.getMapByRequest(getRequest());
    	String contextpath=getRequest().getRealPath("");
		map.put("contextpath", contextpath);
    	String path= this.ywPrintDocService.exportExcel(map);
		if(StringUtils.isNotBlank(path)){
			getResponse().getWriter().print(path);
		}
    	return null;
    }
    /**
     * 导出区审批查询数据
     * @return
     * @throws IOException 
     */
    public String exportQuData() throws IOException{
    	Map map=RequestUtil.getMapByRequest(getRequest());
    	String contextpath=getRequest().getRealPath("");
		map.put("contextpath", contextpath);
		map.put("filearea", "qu");
		map.put("orgName", getLoginUser().getOrg().getOrgName());
    	String path= this.ywPrintDocService.exportExcel(map);
		if(StringUtils.isNotBlank(path)){
			getResponse().getWriter().print(path);
		}
    	return null;
    }
	
	/**
	 * 文号查询
	 * @return
	 */
	public String  findFileNum() {
		String type=getParameter("type");
		Map map=this.getMapByRequest(getRequest());
		if(StringUtils.isNotBlank(type)){//表示制文的时候查看
			String year=DateUtilsEX.getCurYear();
			//生成文号类型
			List filetypes=this.ywPrintDocService.getFileType(map);
			if(filetypes.size()>0){
				getRequest().setAttribute("filetypes", filetypes.get(0));
			}
			String templateCode=(String) map.get("templateCode");
			String fileCode=(String) map.get("fileCode");
			getRequest().setAttribute("curyear", year);
			getRequest().setAttribute("fileCode", fileCode);
			getRequest().setAttribute("templateCode", templateCode);
		}
		return "findfileNum";
	}
	
	
	public YwPrintDocForm getModel() {
		return form;
	}

	public void prepare() throws Exception {
		if(id != null)
			form = ywPrintDocService.get(id);
		else
			form = new YwPrintDocForm();
	}
	
	 private  Map getMapByRequest(HttpServletRequest request) {
	        Map<String, String> map = new HashMap<String, String>();
	        Enumeration enu = request.getParameterNames();
	        while(enu.hasMoreElements()) {   
	            String paraName = (String)enu.nextElement();   
	            String paraValue = request.getParameter(paraName).trim(); 
	            //if(paraValue!=null && !"".equals(paraValue)){
	                map.put(paraName, paraValue);
	            //}           
	        }
	                
	        return map;
	    }
	public String toCkrqqydjb(){
		return "toCkrqqydjb";
	}
	
	public String listRqQyDjb(){
		Map map = RequestUtil.getMapByRequest(getRequest());
	    if(page==null){
	  		  page = new Page(15);
	  	 }
	    ExtUtils.initPageFromExtGridParam(getRequest(), page);
	  	page=this.ywPrintDocService.searchRqQyDjb(page,map);
	  	renderText(Struts2Utils.getJsonString(page, DateUtils.YYYY_MM_DD_HH_MM_SS));
	  	
	  	return null;
	}
}
	
